clear

set more off

set seed 112630084

/*------------------------------------------------------------
*DEFINE DIRECTORIES
------------------------------------------------------------*/

global basedir "/Volumes/Passport/research/smh_replication/"
*global basedir "/Users/conrad/Desktop/restat_replication/"

global codedir "${basedir}code/"

*directory with included original/raw data
global rawdir "${basedir}data/raw/"

*directory with sensitive data not included in repostitory
global sensdir "${basedir}data/restricted/"

*directory where intermediate data are stored
global datadir "${basedir}data/intermediate/"

*directory where log files are stored
global logdir "${basedir}logs/"

*directory where output is stored (i.e., exhibits)
global outdir "${basedir}output/"

/*------------------------------------------------------------
*INSTALL PACKAGES
------------------------------------------------------------*/

*ssc install vincenty

/*------------------------------------------------------------
*PROGRAMS
------------------------------------------------------------*/

set printcolor automatic

do ${codedir}1-create_pop_working.do

/*
Description: this program takes IPUMS and CTPP Census data and constructs
measures for the spatial distribution of work (central city versus suburbs) by
year and MSA.

The program generates the following dta files:
- pop_working.dta
*/

do ${codedir}2-create_census_cells.do

/*
Description: this program takes IPUMS Census data on individual labor market
outcomes and collapses data to cells by MSA, year, cohort, race, education and
sex.

The program generates the following dta files:

- ls_70.dta
- ls_80.dta
- ls_90.dta
- ls_00.dta
- ls_70_panel.dta
*/

do ${codedir}3-create_sector_indices.do

/*
Description: this program creates indices for changes in sector composition used 
to construct Appendix Table A7.

The program generates the following dta files:

- fcc_share_ind.dta
- fcc_share_occ.dta
*/

do ${codedir}4-market_analysis.do

/*
Description: this program generates all tables for the market-level analysis
portion of the paper.

The program generates the following exhibits:

- Table 2
- Table 3
- Table 4
- Table 5
- Table A4
- Table A5
- Table A6
- Table A7
- Table A9
*/

do ${codedir}5-dist_gradient.do

/*
Description: this program analyzes the relationship between establishment
distance from the central business district and its racial composition of
employees.

The program generates the following exhibits:

- Table 1
- Figure 1(A)
- Appendix Table A3 (partial)

The program generates the following dta files:

- pblackpd_slope_msa.dta
- pblackpd_all.dta
*/

do ${codedir}6-res_gradient.do

/*
Description: this program analyzes the relationship between neighborhood
distance from the central business district and its racial composition of
residents.

The program generates the following exhibits:

- Figure 1(B)
- Appendix Table A3 (partial)
*/

do ${codedir}7-movers_analysis.do


/*
Description: this program generates the event study analysis of relocating
establishments.

The program generates the following exhibits:
- Figure 2

*/

do ${codedir}8-create_figure3.do

/*
Description: this program generates Figure 3, which plots the relationship
job suburbanization and changes in employment rates for one cohort.

The program generates the following exhibits:

- Figure 3
*/

do ${codedir}9-migration.do

/*
Description: this program repeats a subset of the market-level analysis for a
1975-1980 panel of workers.

The program generates the following exhibits:

- Table A8
*/
